package state.group.events;

public enum EventType {

    DoorEvent(0x01),
    FloorEvent(0x02),
    StartEvent(0x03),
    StopEvent(0x04),
    RegistrationEvent(0x05),
    DeregistrationEvent(0x06),
    DirectionEvent(0x07),
    HallCallEvent(0x08),
    PersonDispatcherEvent(0x09),
    
    //Person Dispatcher-specific events
    DestinationEvent(0x0A),
    GoingInEvent(0x0B),
    GoingOutEvent(0x0C),
    InsideEvent(0x0D),
    WaitingEvent(0x0E),
    PersonRegisterEvent(0x0F),
    ;
    
    private byte identifier;
    
    private EventType(int identifier)
    {
        this.identifier = (byte) identifier;
    }
    
    public byte getIdentifier()
    {
        return identifier;
    }
    
    public static EventType getEventTypeForId(byte identifier)
    {
        for (EventType e : EventType.values())
        {
            if (identifier == e.getIdentifier())
            {
                return e;
            }
        }
        
        return null;
    }
    
}
